package com.zhiwang.planet.ui.template

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.zhiwang.planet.R
import kotlinx.android.synthetic.main.activity_simple_list.*


abstract class SimpleListActivity<T> : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_simple_list)

        smartRefresh.setOnRefreshListener {
            onRefresh()
        }
    }

    abstract fun getToolBarTitle(): String

    abstract fun onRefresh()

    abstract fun onLoadMore()

    fun renderMore(dataList: List<T>) {

    }

    fun onRefreshComplete() = smartRefresh.finishRefresh()

    fun onLoadMoreComplete() = smartRefresh.finishLoadMore()
}

